﻿<common:LayoutAwarePage
    x:Class="複雑なストップウォッチ.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Marimo.複雑なストップウォッチ"
    xmlns:common="using:Marimo.複雑なストップウォッチ.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    DataContext="{Binding Main, Source={StaticResource Locator}}">
    <common:LayoutAwarePage.Resources>
        <common:TimeSpanToStringConverter x:Key="TimeSpanToStringConverter"/>
    </common:LayoutAwarePage.Resources>
    <common:LayoutAwarePage.BottomAppBar>
		<AppBar>
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<StackPanel Orientation="Horizontal"/>
				<StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
					<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource PlayAppBarButtonStyle}" Command="{Binding 開始する, Mode=OneWay}"/>
					<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Style="{StaticResource StopAppBarButtonStyle}" Command="{Binding 停止する, Mode=OneWay}"/>
				</StackPanel>
			</Grid>
		</AppBar>
	</common:LayoutAwarePage.BottomAppBar>

    <Grid Style="{StaticResource LayoutRootStyle}">
        <Viewbox>
            <TextBlock Text="{Binding 表示時間, ConverterParameter=mm\\:ss, Converter={StaticResource TimeSpanToStringConverter}, Mode=OneWay}" FontFamily="Segoe UI Semibold"/>
        </Viewbox>
        <!-- Back button and page title -->
        <VisualStateManager.VisualStateGroups>
            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
